﻿using MediatR;
using Microsoft.AspNetCore.Mvc;
using RBAC_Get.API.Application.Commands;

namespace RBAC_Get.API.Controllers
{
    /// <summary>
    /// RBAC控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RBACsController : ControllerBase
    {
        IMediator mediator;

        public RBACsController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 绑定权限下拉框
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<THE_WIND_RISES.Common.Dtos.Result> ShowPermissionData(ShowPermissionCommand cmd)
        {
            return await mediator.Send(cmd);
        }
        /// <summary>
        /// 绑定角色下拉框
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<THE_WIND_RISES.Common.Dtos.Result> ShowRoleData(ShowRoleCommand cmd)
        {
            return await mediator.Send(cmd);
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<THE_WIND_RISES.Common.Dtos.Result> ShowUserData(ShowUserCommand cmd)
        {
            Console.WriteLine("test");
            return await mediator.Send(cmd);
        }
    }
}
